﻿using KinonekoSoftware.Foundation.UI.Converters;

namespace KinonekoSoftware.Studio.Resources.Converters
{
    public class SponsorConverter : ConverterBase
    {
        private static readonly Bitmap Sponsor1 = ImageConverterBase.Open(new Uri("avares://KinonekoSoftware.Studio.Views.DSK/Assets/Images/sponsor.png"));
        private static readonly Bitmap Sponsor2 = ImageConverterBase.Open(new Uri("avares://KinonekoSoftware.Studio.Views.DSK/Assets/Images/sponsor2.png"));
        private static readonly Bitmap Sponsor3 = ImageConverterBase.Open(new Uri("avares://KinonekoSoftware.Studio.Views.DSK/Assets/Images/sponsor3.png"));
        private static readonly Bitmap Sponsor4 = ImageConverterBase.Open(new Uri("avares://KinonekoSoftware.Studio.Views.DSK/Assets/Images/sponsor4.png"));

        private static int _index;
        
        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            _index++;
            var i = _index % 4;
            return i switch
            {
                1 => Sponsor2,
                2 => Sponsor3,
                3 => Sponsor4,
                _ => Sponsor1,
            };
        }
    }
}